﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartHotel.BLL;
using SmartHotel.DAL;
using SmartHotel.Model;

namespace SmartHotel.WebAPI.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class JiFenController : ControllerBase
    {
        public JiFenController(JiFenBLL jiFenBLL)
        {
            JiFenBLL = jiFenBLL;
        }
        
        public JiFenBLL JiFenBLL { get; }
        [HttpPost]
        public int Add(JiFen jiFen)
        {
            return JiFenBLL.Add(jiFen);
        }
        /// <summary>
        /// 用于前端调用的分页方法
        /// </summary>
        /// <param name="index">当前页码</param>
        /// <param name="size">每页大小</param>
        /// <returns></returns>
        [HttpGet]
        public MyPage<JiFen> GetJifenPages(int index, int size)
        {
            int count = 0;   
            return JiFenBLL.GetJifenPages(index,size,out count);
        }
    }
}
